/**
 *
 *导航守卫
 */

//前置
export const beforeEach = (to, from, next) => {
  if (to.matched.length ===0) {  //如果未匹配到路由
    // from.path? next({ path:from.path}) : next('/');   //如果上级也未匹配到路由则跳转主页面，如果上级能匹配到则转上级路由
    next('/404')
  } else {
    next();    //如果匹配到正确跳转
  }
}

//后置
export const afterEach = () => {
 // console.log('后置')
}
